home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / rs6000 / memcopy.h < prev   
C/C++ Source or Header  |  1992-03-17  |  3KB  |  87 lines

  1. /* Copyright (C) 1991 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #include <sysdeps/generic/memcopy.h>
  20.  
  21. #undef    OP_T_THRES
  22. #define OP_T_THRES 32
  23.  
  24. #undef    BYTE_COPY_FWD
  25. #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes)                      \
  26.   do                                          \
  27.     {                                          \
  28.       size_t __nbytes = nbytes;                              \
  29.       asm volatile("mtspr    1,%2\n"                          \
  30.            "lsx        6,0,%1\n"                      \
  31.            "stsx    6,0,%0" : /* No outputs.  */ :              \
  32.            "b" (dst_bp), "b" (src_bp), "r" (__nbytes) :              \
  33.            "6", "7", "8", "9", "10", "11", "12", "13");              \
  34.       dst_bp += __nbytes;                              \
  35.       src_bp += __nbytes;                              \
  36.     } while (0)
  37.  
  38. #undef    BYTE_COPY_BWD
  39. #define BYTE_COPY_BWD(dst_ep, src_ep, nbytes)                      \
  40.   do                                          \
  41.     {                                          \
  42.       size_t __nbytes = (nbytes);                          \
  43.       dst_ep -= __nbytes;                              \
  44.       src_ep -= __nbytes;                              \
  45.       asm volatile("mtspr    1,%2\n"                          \
  46.            "lsx        6,0,%1\n"                      \
  47.            "stsx    6,0,%0" : /* No outputs.  */ :              \
  48.            "b" (dst_ep), "b" (src_ep), "r" (__nbytes) :              \
  49.            "6", "7", "8", "9", "10", "11", "12", "13");              \
  50.     } while (0)
  51.  
  52. #undef    WORD_COPY_FWD
  53. #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes)              \
  54.   do                                          \
  55.     {                                          \
  56.       size_t __nblocks = (nbytes) / 32;                          \
  57.       if (__nblocks != 0)                              \
  58.     asm volatile("mtctr    %4\n"                          \
  59.              "lsi    6,%1,32\n"                      \
  60.              "ai    %1,%1,32\n"                      \
  61.              "stsi    6,%0,32\n"                      \
  62.              "ai    %0,%0,32\n"                      \
  63.              "bdn    $-16" :                          \
  64.              "=b" (dst_bp), "=b" (src_bp) :                  \
  65.              "0" (dst_bp), "1" (src_bp), "r" (__nblocks) :          \
  66.              "6", "7", "8", "9", "10", "11", "12", "13");          \
  67.       (nbytes_left) = (nbytes) % 32;                          \
  68.     } while (0)
  69.  
  70. #undef    WORD_COPY_BWD
  71. #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes)              \
  72.   do                                          \
  73.     {                                          \
  74.       size_t __nblocks = (nbytes) / 32;                          \
  75.       if (__nblocks != 0)                              \
  76.     asm volatile("mtctr    %4\n"                          \
  77.              "ai    %1,%1,-32\n"                      \
  78.              "lsi    6,%1,32\n"                      \
  79.              "ai    %0,%0,-32\n"                      \
  80.              "stsi    6,%0,32\n"                      \
  81.              "bdn    $-16" :                          \
  82.              "=b" (dst_ep), "=b" (src_ep) :                  \
  83.              "0" (dst_ep), "1" (src_ep), "r" (__nblocks) :          \
  84.              "6", "7", "8", "9", "10", "11", "12", "13");          \
  85.       (nbytes_left) = (nbytes) % 32;                          \
  86.     } while (0)
  87.